<?php

namespace app\admin\controller\depot\async;

use app\common\controller\Backend;

/**
 * 入库异步管理
 */
class Storage extends Backend
{
    protected $model = null;
    protected $relationSearch = true;
    protected $noNeedRight = ['*'];

    public function _initialize()
    {
      parent::_initialize();
      $this->model = model('Depot.Storage.Storage');
    }

    /**
     * 返回当前选中供应商
     */
    public function supplier($ids = NULL)
    {
      $row = model("Depot.Supplier")->find(['id' => $ids]);

      if(!$row)
      {
        $this->error(__('No Results were found'));
      }else{
        $this->success(null, null, $row);
      }
    }

    /**
     * 返回当前选中商品
     */
    public function product($ids = NULL)
    {
      $row = model('Product.Product')->find(['id' => $ids]);

      if(!$row)
      {
        $this->error(__('No Results were found'));
      }else
      {
        $this->success(null, null, $row);
      }
    }
}
